<?php
class AdvertisingInformationAirlineAction extends LVAction{
	var $model = "AdvertisingInformationAirline";
	//列表信息使用模板
	var $list_template = "Advertisement/airline_list";
	var $view_template = "Advertisement/airline_detail";

	public function search_by_name(){
		if(!empty($_GET['q'])){
			$this->model = M($this->model);
			import("ORG.Util.Page");
			$count = $this->model->where("state=1 and airline_name like '%{$_GET['q']}%'")->count();
			$Page = new Page($count,10);
			$show = $Page->show();
			$list = $this->model->where("state=1 and airline_name like '%{$_GET['q']}%'")->limit($Page->firstRow.','.$Page->listRows)->order("id desc")->select();
			$this->assign("module_name",$this->module_name);
			$this->assign("list",$list);
			$this->assign("show",$show);
			$this->display($this->list_template);
		}
	}

	public function search_by_shipment(){
		if(!empty($_GET['q'])){
			$this->model = M($this->model);
			import("ORG.Util.Page");
			$count = $this->model->where("state=1 and shipment >= {$_GET['q']}")->count();
			$Page = new Page($count,10);
			$show = $Page->show();
			$list = $this->model->where("state=1 and shipment >= {$_GET['q']}")->limit($Page->firstRow.','.$Page->listRows)->order("id desc")->select();
			$this->assign("module_name",$this->module_name);
			$this->assign("list",$list);
			$this->assign("show",$show);
			$this->display($this->list_template);
		}
	}
	//按货运量排名
	//默认为倒序,若有$_GET['asc']则为正向
	public function sort_by_shipment(){
		if(isset($_GET['asc'])){
			$this->list_order = "shipment asc";
		}else{
			$this->list_order = "shipment desc";
		}
		$this->listall();
	}

	//按服务质量排名
	//默认为倒序,若有$_GET['asc']则为正向
	public function sort_by_service_quality(){
		if(isset($_GET['asc'])){
			$this->list_order = "service_quality asc";
		}else{
			$this->list_order = "service_quality desc";
		}
		$this->listall();
	}
}
?>
